package com.yykj.tencent.im.server.utils;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import java.util.Map;

/**
 * map object 互转
 */
public class Map2Object {
    //map转java对象
    public static Object mapToObject(Map<String, Object> map, Class<?> beanClass) {
        String jsonStr = JSON.toJSONString(map);
        return JacksonUtil.json2Object(jsonStr,beanClass);
    }

    //java对象转map
    public static Map<String, Object> objectToMap(Object obj) {
        String jsonStr = JSONObject.toJSONString(obj);
        return JSONObject.parseObject(jsonStr);
    }

}
